/*
 * $Id: CreateMapAction.java 24 2009-03-31 23:40:10Z aaron.day $
 */
package org.crazydays.gameplan.map.swing.event;


import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.ImageIcon;

import org.crazydays.gameplan.map.swing.JCreateMapDialog;

/**
 * CreateMapAction
 */
public class CreateMapAction
        extends AbstractAction
{
	/** serial version uid */
	public final static long serialVersionUID =
	        "$Id: CreateMapAction.java 24 2009-03-31 23:40:10Z aaron.day $"
	                .hashCode();

	/** create map dialog */
	protected JCreateMapDialog createMapDialog;

	/**
	 * CreateMapAction constructor.
	 * 
	 * @param text Text
	 * @param icon Icon
	 * @param description Description
	 * @param mnemonic Mnemonic
	 * @param createMapDialog Create map dialog
	 */
	public CreateMapAction(String text, ImageIcon icon, String description,
	        Integer mnemonic, JCreateMapDialog createMapDialog)
	{
		super(text, icon);
		putValue(SHORT_DESCRIPTION, description);
		putValue(MNEMONIC_KEY, mnemonic);
		setCreateMapDialog(createMapDialog);
	}

	/**
	 * Set create map dialog.
	 * 
	 * @param createMapDialog Create map dialog
	 */
	public void setCreateMapDialog(JCreateMapDialog createMapDialog)
	{
		this.createMapDialog = createMapDialog;
	}

	/**
	 * Get create map dialog.
	 * 
	 * @return Create map dialog
	 */
	public JCreateMapDialog getCreateMapDialog()
	{
		return createMapDialog;
	}

	/**
	 * Call create map on the create map dialog.
	 * 
	 * @param e Event
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	public void actionPerformed(ActionEvent e)
	{
		getCreateMapDialog().createMap();
	}
}
